<template>
  <div class="home">
    <button @click="addFn">添加数据</button>
  </div>
</template>

<script>

import { mapActions,mapState } from 'vuex'
import axios from 'axios'
export default {
  name: 'Home',
  components: {

  },
  mounted() {

  },
  methods: {
    addFn() {
      axios({
        method: 'post',
        url: '/api/user',
        data: {
          title: 'Fred',
          content: 'Flintstone',
          author: "devin"
        },
        headers: {
          authorization: sessionStorage.getItem('token')
        }
      }).then(res => {
        console.log(res, 'res')
      })
    }
  }
}
</script>
